package com.boot.configstatistical.repair;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dmall.order.domain.Order;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

/**
 * @author Administrator
 * @className Test1
 * @description TODO
 * @date 2023/11/30 19:23
 **/
@Slf4j
public class Test1 {



    public static String deal(String orderId,String Cookie) throws Exception {

        String storeName = "";
        String url="http://man.order.dmall.com/showOrderJSONData?orderId="+orderId;

        // 创建CookieStore对象
        BasicCookieStore cookieStore = new BasicCookieStore();

        // 创建HttpClient对象
        CloseableHttpClient httpClient = HttpClients.custom()
                .setDefaultCookieStore(cookieStore)
                .build();

        // 创建HttpGet对象并设置请求头Cookie信息
        HttpGet httpGet = new HttpGet(url);
        httpGet.addHeader("Cookie", Cookie);

        // 执行请求并获取响应
        HttpClientContext context = HttpClientContext.create();
        CloseableHttpResponse result = httpClient.execute(httpGet, context);
//        log.info("result={}",JSONObject.toJSONString(result.getEntity()));

        // 输出响应内容
        if (result.getStatusLine().getStatusCode() == 200) {
            String html = EntityUtils.toString(result.getEntity(), "UTF-8");
//            System.out.println(html);
            JSONObject jsonObject =  JSON.parseObject(html);
//            System.out.println("======="+jsonObject);
            storeName=String.valueOf(jsonObject.get("data"));
            Order order = JSONObject.parseObject(storeName, Order.class);
            System.out.println(orderId +" "+order.getShopName());
        }
        // 关闭资源
        result.close();
        httpClient.close();

        return storeName;
    }

    public static void main(String[] args) throws Exception {
        String cookie = "GALAXY_OFFLINE_CLIENT_WEB_VERSION_9e74bd830361046daa00798aa282f1fe=10; dhrUserId=9157561; login_user_name=%E5%AE%89%E6%9D%BE%E6%9E%97; login_type=vpn; loginType=account; updateTime=1698975029000; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2218ba7d63fe0633-02cc4ef12e489f-26031051-2304000-18ba7d63fe1cdc%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMThiYTdkNjNmZTA2MzMtMDJjYzRlZjEyZTQ4OWYtMjYwMzEwNTEtMjMwNDAwMC0xOGJhN2Q2M2ZlMWNkYyJ9%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%22%2C%22value%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218ba7d63fe0633-02cc4ef12e489f-26031051-2304000-18ba7d63fe1cdc%22%7D; inited=true; appname=cloud; username=songlin.an; envRootDomain=dmall.com; return_url=//cloud.dmall.com/#/application/index?versionType=PRO&level=6&code=paycenter-api-prod; login_token=Bearer%20eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MDEwNDkxMjQ4MDUsImV4cCI6MTcwMTY1MzkyNDgwNSwiaXNzIjoia2VuIiwiZGF0YSI6eyJ1c2VyX2luZm8iOnsidXNlcl9pZCI6OTE1NzU2MSwidXNlcl9jb2RlIjoic29uZ2xpbi5hbiIsInVzZXJfbmFtZSI6Ilx1NWI4OVx1Njc3ZVx1Njc5NyIsInByZWZlcnJlZF9uYW1lIjoiXHU1Yjg5XHU2NzdlXHU2Nzk3IiwicGhvbmUiOiIiLCJlbWFpbCI6InNvbmdsaW4uYW5AZG1hbGwuY29tIiwiaHJzX2lkIjo4NjQzOTYxLCJocm1zX2lkIjoxMDAwMTMwODQxLCJ1c2VyX25vIjoiMTAwMDAxMjU4In0sImxvZ2luX3RpbWUiOjE3MDEwNDkxMjQ4MDV9fQ.qdQiBHtqubISqOrVvLzOf59nKH2l-6Yushmlrc3J13o; login_dmall_id=songlin.an; timeZone=Asia/Shanghai; cur_partner_pc_menu=%5B%7B%22k%22%3A-1%2C%22n%22%3A%22os%u7F51%u9875%u7248%22%2C%22p%22%3A-1%2C%22l%22%3A-1%2C%22r%22%3A-1%7D%5D; signature=3c3ceceb049a2d86c2c19d7758b2f2e6; timestamp=1701332651; UYBFEWAEE=9DEFB1D8615C14E04C91DC78BE64478CCB124D844442FF36C428BA2B3B1EA906888DBBF5507F840AEE3E7A1A1B9D56B2E7CAD66981370C642472D2D7FED85263; login_no=eW9uZy56aGFvXzE1ODI4NTM4Mzg3; wm_menu_id=menu_4835; order-zone=gz01";
        cookie = "GALAXY_OFFLINE_CLIENT_WEB_VERSION_9e74bd830361046daa00798aa282f1fe=10; dhrUserId=9157561; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2218ba7d63fe0633-02cc4ef12e489f-26031051-2304000-18ba7d63fe1cdc%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMThiYTdkNjNmZTA2MzMtMDJjYzRlZjEyZTQ4OWYtMjYwMzEwNTEtMjMwNDAwMC0xOGJhN2Q2M2ZlMWNkYyJ9%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%22%2C%22value%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218ba7d63fe0633-02cc4ef12e489f-26031051-2304000-18ba7d63fe1cdc%22%7D; timeZone=Asia/Shanghai; language=zh; loginType=account; login_token=Bearer%20eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MDQ4NTE4NjMxOTYsImV4cCI6MTcwNTQ1NjY2MzE5NiwiaXNzIjoia2VuIiwiZGF0YSI6eyJ1c2VyX2luZm8iOnsidXNlcl9pZCI6OTE1NzU2MSwidXNlcl9jb2RlIjoic29uZ2xpbi5hbiIsInVzZXJfbmFtZSI6Ilx1NWI4OVx1Njc3ZVx1Njc5NyIsInByZWZlcnJlZF9uYW1lIjoiXHU1Yjg5XHU2NzdlXHU2Nzk3IiwicGhvbmUiOiIiLCJlbWFpbCI6InNvbmdsaW4uYW5AZG1hbGwuY29tIiwiaHJzX2lkIjo4NjQzOTYxLCJocm1zX2lkIjoxMDAwMTMwODQxLCJ1c2VyX25vIjoiMTAwMDAxMjU4In0sImxvZ2luX3RpbWUiOjE3MDQ4NTE4NjMxOTZ9fQ.h3bjfQhYikZ6vOsnaI8PmZMfozQY7xoOUUGcHzxwCdc; login_user_name=%E5%AE%89%E6%9D%BE%E6%9E%97; login_type=vpn; login_dmall_id=songlin.an; appname=cloud; username=songlin.an; UYBFEWAEE=EA970CF573B5F3A0725F0C06D37B02DBC3DD18CF3A4AD3A8B5D9EDA5542436333E0994E5D822F51EF3EA220922DFC1C9AC94C22A903347F257E6CBCC94EDEDF3A981510C3196C82723F90D29F9E2ED8C; login_no=\"RGQxMDAwMDEyNThfMTU1MzM3ODM5NTc=\"; envRootDomain=dmall.com; wm_menu_id=menu_4835; signature=22c1a079c563af81b13f168af32afd9e; timestamp=1705051338";
        String storeId[]  = {

                "738907355226",
                "738871842305",
                "738810999789",
                "738803607099",
                "738828955394",
                "738959279453",
                "738805006445",
                "738812464083",
                "738833450633",
                "738809006636",
                "738849310773",
                "738808843727",
                "738959698634",
                "241705044213",
                "738811823770",
                "738833564069",
                "738791183574",
                "738742015170",
                "738833383416",
                "738935287324",
                "738813386825",
                "738813347692",
                "738830539659",
                "738808286251",
                "738806215994",
                "738837623080",
                "738941531297",
                "738831387515",
                "738848779084",
                "738949958607",
                "738813726802",
                "738853246189",
                "738809967710",
                "738854022650",
                "738813335496",
                "738803607099",
                "738963886729",
                "738845194984",
                "738929207267",
                "738808043324",
                "738978284024",
                "738883152009",
                "738827291395",
                "738825950868",
                "738825454712",
                "739008399790",
                "738830054501",
                "738826698465",
                "738905882464",
                "738837130518",
                "738991439767",
                "738808012065",
                "738832518515",
                "738835199891",
                "738914022977",
                "738815526802",
                "738885130930",
                "738848136084",
                "738825950868",
                "738917366947",
                "738809414252",
                "738976170553",
                "738806143768",
                "738826368051",
                "738867206348",
                "738830054501",
                "738831395611",
                "738884635188",
                "738831559117",
                "738806806809",
                "738832755992",
                "738844122476",
                "738817478753",
                "738815951685",
                "738847603564",
                "738829390393",
                "738904255324",
                "738940971808",
                "738836882123",
                "738805539311",
                "738830439516",
                "738807212004",
                "738832518515",
                "738830902407",
                "739012814561",
                "738935915124",
                "738929322157",
                "738831062785",
                "241705049778",
                "738809526487",
                "738805950656",
                "738813851277",
                "738887699903",
                "738846291786",
                "738874015406",
                "738867451638",
                "738832755992",
                "738861930772",
                "738998051383",
                "738806979946",
                "738808154976",
                "738808770982",
                "738829711993",
                "738825174307",
                "738830439516",
                "738808203490",
                "738858910826",
                "738890403385",
                "738923634111",
                "738826387256",
                "738807223262",
                "738949958607",
                "738854343140",
                "738846782995",
                "738816795736",
                "738741314770",
                "738952919903",
                "738922676074",
                "738813063192",
                "738812987852",
                "738956051182",
                "738816795736",
                "738830047684",
                "738813422996",
                "738826387256",
                "739009315220",
                "738833362690",
                "738829770285",
                "738988710558",
                "738802631102",
                "738808015460",
                "738817478753",
                "738835778257",
                "738824720063",
                "738828448029",
                "738812267247",
                "738816031739",
                "738808347861",
                "738825579048",
                "738991439767",
                "738990791329",
                "738936122846",
                "738922676074",
                "738940971808",
                "738908110429",
                "738971614225",
                "738816044093",
                "738824834427",
                "738828034865",
                "738809910490",
                "738821262392",
                "738806288020",
                "738686695944",
                "738820571613",
                "738908110429",
                "738826268020",
                "738851339591",
                "738806207670",
                "738776854994",
                "738884707833",
                "738814022217",
                "738814139233",
                "738874015406",
                "738830539659",
                "738830047684",
                "738810930990",
                "738831406348",
                "738834018213",
                "738826631211",
                "738835651208",
                "738814022217",
                "738835123780",
                "738813550467",
                "738960555296",
                "738826268020",
                "738833564069",
                "738928574913",
                "738823547504",
                "738579708091",
                "738831406348",
                "738809807306",
                "738808518809",
                "738812987852",
                "738806938676",
                "738843930152",
                "738811391419",
                "738946503765",
                "738816731166",
                "738846863905",
                "738833150927",
                "738813335496",
                "738848878613",
                "738579303612",
                "738961435672",
                "738951362278",
                "738811914900",
                "738827203276",
                "738833383416",
                "738808703431",
                "738829410808",
                "738807395472",
                "738842358835",
                "738823091165",
                "738813422996",
                "738812464083",
                "738845942245",
                "738813550467",
                "738951291600",
                "738830994933",
                "738943268006",
                "738813206658",
                "738810096092",
                "738835778257",
                "738935678495",
                "738811475324",
                "738700506440",
                "738808012065",
                "738845918720",
                "738814279183",
                "738809818870",
                "738829390393",
                "738836778636",
                "738816044093",
                "738900411229",
                "738881311176",
                "738830103128",
                "738941530905",
                "738826368051",
                "738813131114",
                "738906899555",
                "738899559832",
                "738808795211",
                "738936954224",
                "738828995959",
                "738933503368",
                "738970798474",
                "738923271749",
                "738983395012",
                "738811058561",
                "738890791104",
                "738813726802",
                "738834146233",
                "738825950868",
                "738785955400",
                "738852855454",
                "738779687874",
                "738825038325",
                "738828995959",
                "738804954985",
                "738846654894",
                "738825558466",
                "738825146295",
                "738876034976",
                "738825958934",
                "738808431831",
                "738819900055",
                "738974170948",
                "738811107682",
                "738963414757",
                "738828034865",
                "738812411753",
                "738809967710",
                "738812295854",
                "738806235119",
                "738810451568",
                "738833222963",
                "738855802687",
                "738816731166",
                "738992870958",
                "738813784081",
                "738817523014",
                "738811118760",
                "738951472020",
                "738836027364",
                "738993291007",
                "738846367308",
                "738890403385",
                "738824975658",
                "738827203276",
                "738808950644",
                "738897327997",
                "739000507229",
                "738831922631",
                "738947619087",
                "738816642937",
                "738809538764",
                "738809391473",
                "738830102457",
                "738784443660",
                "738842258998",
                "737280880094",
                "738846939915",
                "738994262714",
                "738816078337",
                "738808950644",
                "738829506965",
                "738951319787",
                "142880102401",
                "738817146677",
                "738814115041",
                "738804930498",
                "738828043806",
                "738824631019",
                "738806387495",
                "738806819246",
                "738834018213",
                "738846719065",
                "738941526580",
                "738800379759",
                "738830103128",
                "738805315769",
                "738809910490",
                "738833222963",
                "738829606325",
                "738811386842",
                "738957194265",
                "738807903940",
                "738835886350",
                "738812926229",
                "738710946985",
                "738805195699",
                "738959279453",
                "738927950988",
                "738849255291",
                "738956070326",
                "738808467024",
                "738837454203",
                "738824631019",
                "738950348083",
                "738806387495",
                "738810234947",
                "738948022340",
                "738808286251",
                "738716254633",
                "739008686975",
                "738777863252",
                "738805462793",
                "738813562765",
                "738844975547",
                "738816031739",
                "738824258867",
                "738959780078",
                "738809591160",
                "738840091332",
                "738828063626",
                "738831902194",
                "738868754446",
                "738956795059",
                "738904338999",
                "738843954793",
                "738808139960",
                "738885723174",
                "738984314454",
                "738813386825",
                "738799555423",
                "738845918720",
                "738831062785",
                "738830171878",
                "738921587021",
                "738828034865",
                "738936551198",
                "738830103128",
                "738941530905",
                "738806770583",
                "738823002431",
                "738833150927",
                "738845526736",
                "738831922631",
                "738870603952",
                "107653",
                "738853354249",
                "738825451037",
                "738839170255",
                "738829758962",
                "738966454410",
                "738925675631",
                "739012247026",
                "738823316021",
                "738812951972",
                "738883642999",
                "738996203495",
                "738966454410",
                "738802631102",
                "738829906938",
                "738816642937",
        };
        for (String orderId : storeId) {
            deal(orderId,cookie);
        }

    }
}
